%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/basics-with-author"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[43]<br />ᐳ: 9, 10, 52, 53, 54, 11, 13, 28<br />2: PgSelectInlineApply[47]<br />3: PgSelect[8]<br />ᐳ: Access[48]<br />4: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 48<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 48, 15<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 49, 50<br />2: PgSelectRows[29]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 50<br /><br />ROOT __Item{3}ᐸ29ᐳ[30]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 31, 44<br /><br />ROOT PgSelectSingle{3}ᐸmessagesᐳ[31]<br />1: <br />ᐳ: 32, 45, 46<br />2: PgSelectRows[39]<br />ᐳ: First[38], PgSelectSingle[40]"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 40<br /><br />ROOT PgSelectSingle{4}ᐸusersᐳ[40]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket5

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'YES' ]ᐳ[54]"}}:::plan
    PgSelectInlineApply47["PgSelectInlineApply[47∈0] ➊<br />More deps:<br />- Constantᐸ2ᐳ[52]"]:::plan
    Object11 & Lambda13 & PgSelectInlineApply47 --> PgSelect8
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[53]"}}:::plan
    PgSelectInlineApply43["PgSelectInlineApply[43∈0] ➊"]:::plan
    Lambda28 & PgSelectInlineApply43 --> PgSelectInlineApply47
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Access48{{"Access[48∈0] ➊<br />ᐸ8.m.subqueryDetailsFor21ᐳ"}}:::plan
    PgSelect8 --> Access48
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    List49{{"List[49∈2]<br />ᐸ48,15ᐳ"}}:::plan
    Access48 & __Item15 --> List49
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    PgSelectRows29[["PgSelectRows[29∈2]"]]:::plan
    Lambda50{{"Lambda[50∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda50 --> PgSelectRows29
    List49 --> Lambda50
    __Item30[/"__Item[30∈3]<br />ᐸ29ᐳ"\]:::itemplan
    PgSelectRows29 ==> __Item30
    PgSelectSingle31{{"PgSelectSingle[31∈3]<br />ᐸmessagesᐳ"}}:::plan
    __Item30 --> PgSelectSingle31
    Access44{{"Access[44∈3]<br />ᐸ50.m.joinDetailsFor34ᐳ"}}:::plan
    Lambda50 --> Access44
    List45{{"List[45∈4]<br />ᐸ44,31ᐳ"}}:::plan
    Access44 & PgSelectSingle31 --> List45
    PgClassExpression32{{"PgClassExpression[32∈4]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle31 --> PgClassExpression32
    First38{{"First[38∈4]"}}:::plan
    PgSelectRows39[["PgSelectRows[39∈4]"]]:::plan
    PgSelectRows39 --> First38
    Lambda46{{"Lambda[46∈4]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda46 --> PgSelectRows39
    PgSelectSingle40{{"PgSelectSingle[40∈4]<br />ᐸusersᐳ"}}:::plan
    First38 --> PgSelectSingle40
    List45 --> Lambda46
    PgClassExpression41{{"PgClassExpression[41∈5]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle40 --> PgClassExpression41
    PgClassExpression42{{"PgClassExpression[42∈5]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression41 o--o PgClassExpression42

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28,PgSelectInlineApply43,PgSelectInlineApply47,Access48 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,PgSelectRows29,List49,Lambda50 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item30,PgSelectSingle31,Access44 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression32,First38,PgSelectRows39,PgSelectSingle40,List45,Lambda46 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression41,PgClassExpression42 bucket5

